﻿@using Masa.Blazor.Presets

<div class="text-center">
    <PMobilePicker @bind-Value="_value"
                   Columns="@_columns"
                   TColumn="List<string>"
                   TColumnItem="string"
                   TColumnItemValue="string"
                   ItemValue="item => item"
                   ItemText="item => item"
                   ItemHeight="64">
        <ActivatorContent>
            <MButton Color="primary" Class="text-capitalize" Text @attributes="@context.Attrs">
                @(_value.Count == 0 ? "Please select" : string.Join(" ", _value))
            </MButton>
        </ActivatorContent>
    </PMobilePicker>
</div>

@code {

    private static readonly string DayOfWeek = DateTime.Now.DayOfWeek.ToString();
    private static readonly string AmPm = DateTime.Now.Hour > 12 ? "PM" : "AM";

    private readonly List<List<string>> _columns = new()
    {
        new List<string>
        {
            System.DayOfWeek.Monday.ToString(),
            System.DayOfWeek.Tuesday.ToString(),
            System.DayOfWeek.Wednesday.ToString(),
            System.DayOfWeek.Thursday.ToString(),
            System.DayOfWeek.Friday.ToString(),
            System.DayOfWeek.Saturday.ToString(),
            System.DayOfWeek.Sunday.ToString()
        },
        new List<string>
        {
            "AM",
            "PM"
        }
    };

    private List<string> _value = new() { DayOfWeek, AmPm };

}
